package com.library.controller.admin;

import com.library.result.Result;
import com.library.service.AdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/admin")
@Api(tags = "管理员相关接口")
@Slf4j
public class AdminController {

    @Autowired
    private AdminService adminService;

    //管理员修改用户权限
    @PostMapping("/updateUserRole/{role}")
    @ApiOperation("管理员修改用户权限")
    public Result<String> updateUserRole(Long userId, @PathVariable Integer role) {
        log.info("管理员修改用户权限：{}", userId);
        adminService.updateUserRole(userId, role);
        return Result.success();
    }


}
